package com.funny.rabbitmq.qos;

import com.funny.rabbitmq.utils.RabbitMQUtils;
import com.rabbitmq.client.Channel;

public class Producer {

    private final static String QUEUE_NAME = "hello";

    public static void main(String[] args) throws Exception {
        Channel channel = RabbitMQUtils.getChannel();
        channel.confirmSelect();

        channel.queueDeclare(QUEUE_NAME, false, false, false, null);
        for (int i = 5; i <= 20; i++) {
            String msg = "hello world_" + i;
            channel.basicPublish("", QUEUE_NAME, null, msg.getBytes());
            System.out.println("消息发送成功");
        }
    }
}
